home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / pour.dxr / 00007_Minute hand behavior.ls < prev    next >
Encoding:
Text File  |  2000-03-23  |  1.2 KB  |  51 lines

  1. property pSpr, pCenter, pRadius
  2.  
  3. on beginSprite me
  4.   pSpr = sprite(me.spriteNum)
  5.   pCenter = sprite(me.spriteNum - 2).loc
  6.   pRadius = 20
  7. end
  8.  
  9. on mUpdate me, Quantity
  10.   if Quantity >= 1 then
  11.     ounces = integer(Quantity - 0.5)
  12.     percent = Quantity - ounces
  13.   else
  14.     percent = Quantity
  15.   end if
  16.   theta = percent * 6.28319000000000027
  17.   pSpr.member.shapeType = #line
  18.   if percent <= 0.25 then
  19.     direction = 1
  20.   else
  21.     if (percent > 0.25) and (percent <= 0.5) then
  22.       direction = 0
  23.     else
  24.       if (percent > 0.5) and (percent <= 0.75) then
  25.         direction = 1
  26.       else
  27.         if (percent > 0.75) and (percent <= 1.0) then
  28.           direction = 0
  29.         end if
  30.       end if
  31.     end if
  32.   end if
  33.   pSpr.member.lineDirection = direction
  34.   newVertex = pCenter + point(integer(pRadius * sin(theta)), -integer(pRadius * cos(theta)))
  35.   if pCenter[1] = newVertex[1] then
  36.     newVertex[1] = newVertex[1] + 3
  37.     pSpr.member.shapeType = #rect
  38.   else
  39.     if pCenter[2] = newVertex[2] then
  40.       newVertex[2] = newVertex[2] + 3
  41.       pSpr.member.shapeType = #rect
  42.     end if
  43.   end if
  44.   pSpr.rect = rect(pCenter, newVertex)
  45.   sendSprite(me.spriteNum - 1, #mUpdate, Quantity)
  46. end
  47.  
  48. on endSprite me
  49.   pSpr.member.shapeType = #line
  50. end
  51.